const components = new Map<string, any>();
const componentFiles = new Map<string, any>();
componentFiles.set(
	'input',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'input' */ '/@/components/Linxyun/element/lx-input.vue') })
);
componentFiles.set(
	'dialog-select',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'input' */ '/@/components/Linxyun/element/lx-dialog-select.vue') })
);
componentFiles.set(
	'sequence',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'input' */ '/@/components/Linxyun/element/lx-sequence.vue') })
);
componentFiles.set(
	'el-input',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'input' */ '/@/components/Linxyun/element/lx-input.vue') })
);
componentFiles.set(
	'el-textarea',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'input' */ '../components/Linxyun/element/lx-input.vue') })
);
componentFiles.set(
	'el-password',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'input' */ '../components/Linxyun/element/lx-input.vue') })
);
componentFiles.set(
	'el-span',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'input' */ '../components/Linxyun/element/lx-input.vue') })
);
componentFiles.set(
	'el-cascader',
	defineAsyncComponent({
		loader: () => import(/* webpackChunkName: 'lx-cascader' */ '../components/Linxyun/element/lx-cascader.vue'),
	})
);
componentFiles.set(
	'el-number',
	defineAsyncComponent({
		loader: () => import(/* webpackChunkName: 'lx-inputNumber' */ '../components/Linxyun/element/lx-inputNumber.vue'),
	})
);
componentFiles.set(
	'rich',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'lx-editor' */ '../components/Linxyun/element/lx-editor.vue') })
);
componentFiles.set(
	'el-select',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'lx-select' */ '/@/components/Linxyun/element/lx-select.vue') })
);
componentFiles.set(
	'select_d',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'lx-select' */ '/@/components/Linxyun/element/lx-select.vue') })
);
componentFiles.set(
	'el-img',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'lx-upload' */ '../components/Linxyun/element/lx-upload.vue') })
);
componentFiles.set(
	'el-upload',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'lx-upload' */ '../components/Linxyun/element/lx-upload.vue') })
);
componentFiles.set(
	'el-image',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'lx-image' */ '../components/Linxyun/element/lx-image.vue') })
);
componentFiles.set(
	'video',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'lx-upload' */ '../components/Linxyun/element/lx-upload.vue') })
);
componentFiles.set(
	'el-date',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'lx-date-picker' */ '../components/Linxyun/element/lx-date-picker.vue') })
);
componentFiles.set(
	'el-date-range',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'lx-date-picker' */ '../components/Linxyun/element/lx-date-picker.vue') })
);
componentFiles.set(
	'el-time',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'lx-time-picker' */ '../components/Linxyun/element/lx-time-picker.vue') })
);
componentFiles.set(
	'el-time-range',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'lx-time-picker' */ '../components/Linxyun/element/lx-time-picker.vue') })
);
componentFiles.set(
	'systime',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'lx-time-picker' */ '../components/Linxyun/element/lx-time-picker.vue') })
);
componentFiles.set(
	'el-button',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'lx-button' */ '../components/Linxyun/element/lx-button.vue') })
);
componentFiles.set(
	'el-radio',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'lx-radioAndCheck' */ '../components/Linxyun/element/lx-radioAndCheck.vue') })
);
componentFiles.set(
	'el-checkbox',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'lx-radioAndCheck' */ '../components/Linxyun/element/lx-radioAndCheck.vue') })
);
componentFiles.set(
	'el-switch',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'lx-switch' */ '../components/Linxyun/element/lx-switch.vue') })
);
componentFiles.set(
	'el-table',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'lx-table' */ '../components/Linxyun/element/lx-table.vue') })
);
componentFiles.set(
	'el-pagination',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'lx-pagination' */ '../components/Linxyun/element/lx-pagination.vue') })
);
componentFiles.set(
	'el-tabs',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'lx-tabs' */ '../components/Linxyun/element/lx-tabs.vue') })
);
componentFiles.set(
	'el-carousel',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'lx-carousel' */ '../components/Linxyun/element/lx-carousel.vue') })
);
componentFiles.set(
	'el-progress',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'lx-progress' */ '../components/Linxyun/element/lx-progress.vue') })
);

componentFiles.set(
	'el-schart',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'pie' */ '../components/Linxyun/customModule/echarts/pie.vue') })
);
componentFiles.set(
	'el-sBar',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'barAndLine' */ '../components/Linxyun/customModule/echarts/barAndLine.vue') })
);
componentFiles.set(
	'el-sLine',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'barAndLine' */ '../components/Linxyun/customModule/echarts/barAndLine.vue') })
);
componentFiles.set(
	'el-infoCount',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'infoCount' */ '../components/Linxyun/customModule/custom/infoCount.vue') })
);
componentFiles.set(
	'el-AttributeBox',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'AttributeBox' */ '../components/Linxyun/customModule/custom/AttributeBox.vue') })
);
componentFiles.set(
	'el-QRCode',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'QRCode' */ '../components/Linxyun/customModule/custom/QRCode.vue') })
);
componentFiles.set(
	'el-Navigation',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'Navigation' */ '../components/Linxyun/customModule/custom/Navigation.vue') })
);
componentFiles.set(
	'el-dropdown',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'dropDown' */ '../components/Linxyun/customModule/custom/dropDown.vue') })
);
componentFiles.set(
	'el-searchBox',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'searchBox' */ '../components/Linxyun/customModule/custom/searchBox.vue') })
);
componentFiles.set(
	'el-autoAddInput',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'autoAddInput' */ '../components/Linxyun/customModule/custom/autoAddInput.vue') })
);
componentFiles.set(
	'el-messageList',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'messageList' */ '../components/Linxyun/customModule/custom/messageList.vue') })
);
componentFiles.set(
	'el-messageCard',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'messageCard' */ '../components/Linxyun/customModule/custom/messageCard.vue') })
);
componentFiles.set(
	'el-phoneTest',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'phoneTest' */ '../components/Linxyun/customModule/custom/phoneTest.vue') })
);
componentFiles.set(
	'el-video',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'video' */ '../components/Linxyun/customModule/custom/video.vue') })
);
componentFiles.set(
	'el-NoticeBar',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'NoticeBar' */ '../components/Linxyun/customModule/custom/NoticeBar.vue') })
);
componentFiles.set(
	'el-consultBar',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'consultBar' */ '../components/Linxyun/customModule/custom/consultBar.vue') })
);
componentFiles.set(
	'code-editor',
	defineAsyncComponent({ loader: () => import(/* webpackChunkName: 'consultBar' */ '../components/Linxyun/customModule/custom/codeEditor') })
);
const componentLocalMap = new Map<string, string>();
addComponentsLocalted('rich', 'filter', 'input');

export function getComponent(cname: string, localted?: string) {
	const realCName = getComponentosLocalted(cname, localted);

	if (realCName != null) {
		const compnt = components.get(realCName);
		if (compnt) {
			return compnt;
		} else {
			const componentFile = componentFiles.get(realCName);
			if (componentFile) {
				const ctemp = componentFile;
				if (ctemp == null) {
					console.log('load component error, componentName: ', realCName);
					return null;
				} else {
					components.set(realCName, ctemp);
					return ctemp;
				}
			} else {
				console.error('cannot find component file, typename: ', realCName);
				return null;
			}
		}
	} else {
		console.error('cannot find component file, typename: ', cname, 'localted: ', localted);
		return null;
	}
}

function addComponentsLocalted(cname: string, localted: string, descCName: string) {
	let key = '';
	if (cname && descCName) {
		if (localted) {
			key = cname + '_' + localted;
		} else {
			key = cname;
		}
		componentLocalMap.set(key, descCName);
	}
}

function getComponentosLocalted(cname: string, localted?: string) {
	if (cname) {
		let key = '';
		if (localted) {
			key = cname + '_' + localted;
		} else {
			key = cname;
		}
		const resultName = componentLocalMap.get(key);
		if (resultName) {
			return resultName;
		} else {
			return cname;
		}
	} else {
		return null;
	}
}
